/*
 *  data.c
 *  Asset modeling
 *
 *  Created by Peeter Meos on 27.02.11.
 *  Copyright 2011 NC3A CAT1. All rights reserved.
 *
 */

#ifndef TYPES_H
	#define TYPES_H
	#include "types.h"
#endif

#include <stdlib.h>

#define FW_POSSIBLE		1
#define FW_NOT_POSSIBLE 0

//MEDEVAC Types

#define RW_ASSET	10 // Helicopter
#define FW_ASSET	20 // Airplane
#define AM_ASSET	30 // Ground ambulance

T_UNIT **create_units()
{
	T_UNIT **units;	
	
	units = (T_UNIT **)malloc(sizeof(T_UNIT *) * 24);
	
	// Populate the initial units
	units[0] = init_unit(36.82, 7.8, 750, "Bn 1", FW_NOT_POSSIBLE, 1);
	units[1] = init_unit(36.91, 7.76, 750, "Bn 2", FW_NOT_POSSIBLE, 2);
	units[2] = init_unit(36.82, 7.8, 750, "Bn 3", FW_NOT_POSSIBLE,3 );
	units[3] = init_unit(36.91, 7.76, 750, "Bn 4", FW_NOT_POSSIBLE, 4);
	units[4] = init_unit(36.77, 8.32, 375, "Bn 5:1", FW_NOT_POSSIBLE, 5);
	units[5] = init_unit(36.47, 7.43, 375, "Bn 5:2", FW_NOT_POSSIBLE, 6);
	units[6] = init_unit(36.91, 7.76, 350, "CS Bn 4", FW_NOT_POSSIBLE, 7);
	units[7] = init_unit(36.77, 8.32, 175, "CS Bn 5:1", FW_NOT_POSSIBLE, 8);
	units[8] = init_unit(36.47, 7.43, 175, "CS Bn 5:2", FW_NOT_POSSIBLE, 9);
	units[9] = init_unit(36.91, 7.76, 250, "CSS Bn 4", FW_NOT_POSSIBLE, 10);
	units[10] = init_unit(36.77, 8.32, 125, "CSS Bn 5:1", FW_NOT_POSSIBLE, 11);
	units[11] = init_unit(36.47, 7.43, 125, "CSS Bn 5:2", FW_NOT_POSSIBLE, 12);
	units[12] = init_unit(36.91, 7.76, 100, "CSS IE Force", FW_NOT_POSSIBLE, 13);
	units[13] = init_unit(36.82, 7.8, 150, "Extra CSS Bn 1", FW_NOT_POSSIBLE, 14);
	units[14] = init_unit(36.91, 7.76, 150, "Extra CSS Bn 2", FW_NOT_POSSIBLE, 15);
	units[15] = init_unit(36.91, 7.76, 350, "Framework Bde", FW_NOT_POSSIBLE, 16);
	units[16] = init_unit(36.91, 7.76, 800, "More theatre CSS", FW_NOT_POSSIBLE, 17);
	units[17] = init_unit(36.82, 7.8, 450, "Op Res CS Force", FW_NOT_POSSIBLE, 18);
	units[18] = init_unit(36.91, 7.76, 5650, "Remaining CSS", FW_NOT_POSSIBLE, 19);
	units[19] = init_unit(36.91, 7.76, 400, "Theatre CSS", FW_NOT_POSSIBLE, 20);
	
	
	units[20] = init_unit(36.77, 8.32, 0,  "El-Tarf", FW_NOT_POSSIBLE, 31);
	units[21] = init_unit(36.47, 7.43, 0, "Guelma", FW_NOT_POSSIBLE, 32);
	units[22] = init_unit(36.85, 7.85, 0, "APOD Annaba", FW_POSSIBLE, 33);
	units[23] = init_unit(36.83, 7.81, 0, "APOD Annat", FW_POSSIBLE, 34); 
	
	
	return units;
}

void free_units(T_UNIT **units)
{
	char i;
	
	for(i=0;i<24;i++)
		free_unit(units[i]);
}

T_ASSET **create_assets()
{
	T_ASSET **assets;
	
	assets = (T_ASSET **)malloc(sizeof(T_ASSET *) * 28);
	
	assets[0] = init_asset(36.83, 7.81, RW_ASSET, 41);
	
	assets[1] = init_asset(36.91, 7.76, AM_ASSET, 51);
	assets[2] = init_asset(36.91, 7.76, AM_ASSET, 52);
	assets[3] = init_asset(36.91, 7.76, AM_ASSET, 53);
	assets[4] = init_asset(36.91, 7.76, AM_ASSET, 54);
	assets[5] = init_asset(36.91, 7.76, AM_ASSET, 55);
	assets[6] = init_asset(36.91, 7.76, AM_ASSET, 56);
	assets[7] = init_asset(36.91, 7.76, AM_ASSET, 57);
	assets[8] = init_asset(36.91, 7.76, AM_ASSET, 58);
	
	assets[9] = init_asset(36.47, 7.43, AM_ASSET, 61);
	assets[10] = init_asset(36.47, 7.43, AM_ASSET, 62);
	assets[11] = init_asset(36.47, 7.43, AM_ASSET, 63);
	assets[12] = init_asset(36.47, 7.43, AM_ASSET, 64);
	assets[13] = init_asset(36.47, 7.43, AM_ASSET, 65);
	assets[14] = init_asset(36.47, 7.43, AM_ASSET, 66);
	
	assets[15] = init_asset(36.83, 7.81, RW_ASSET, 71);
	
	assets[16] = init_asset(36.77, 8.32, AM_ASSET, 81);
	assets[17] = init_asset(36.77, 8.32, AM_ASSET, 82);
	assets[18] = init_asset(36.77, 8.32, AM_ASSET, 83);
	assets[19] = init_asset(36.77, 8.32, AM_ASSET, 84);
	assets[20] = init_asset(36.77, 8.32, AM_ASSET, 85);
	assets[21] = init_asset(36.77, 8.32, AM_ASSET, 86);
	
	assets[22] = init_asset(36.77, 8.32, FW_ASSET, 91);
	assets[23] = init_asset(36.77, 8.32, FW_ASSET, 92);
	assets[24] = init_asset(36.77, 8.32, FW_ASSET, 93);
	assets[25] = init_asset(36.77, 8.32, FW_ASSET, 94);
	assets[26] = init_asset(36.77, 8.32, FW_ASSET, 95);
	assets[27] = init_asset(36.77, 8.32, FW_ASSET, 96);
	
	return assets;
}

void free_assets(T_ASSET **units)
{
	char i;
	
	for(i=0;i<28;i++)
		free_asset(units[i]);
}
